<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="/pear/component/layui/css/layui.css">
    <link rel="stylesheet" href="/pear/component/pear/css/pear.css" />
    <script src="/pear/component/layui/layui.js"></script>
</head>
<body>

<div class="layui-card">
    <div class="layui-card-body">
        <table id="demo" lay-filter="demo"></table>
    </div>
</div>

<script src="/pear/component/layui/layui.js"></script>
<script src="/pear/component/pear/pear.js"></script>
<script>
    layui.use('table', function(){
        var table = layui.table,
            layer = layui.layer,
            $ = layui.jquery;
        table.render({
            elem: '#demo'
            ,url: '/apply/serviceList' //数据接口
            ,skin: 'line'
            ,cols: [
                [ //表头
                    {field: 'customerName', title: '用户名', width:80}
                    ,{field: 'serviceType', title: '服务类型', width:100}
                    ,{field: 'serviceDate', title: '服务日期', width:120}
                    ,{field: 'Note', title: '备注说明',  width: 100}
                    ,{field: 'selectDate', title: '选择日期', width: 120}
                    ,{field: 'Cost', title: '预计花费', width: 120}
                    ,{field: 'serviceTime', title: '服务时长',width: 120}
                    ,{field: 'Dealed', title: '处理状态', width: 120}
                    ,{field: 'remark', title: '反馈', width: 135, edit:"text"}
                ]
            ]
        });

        table.on('edit(demo)', function(obj){
            console.log(obj);
            var value = obj.value //得到修改后的值
                ,data = obj.data //得到所在行所有键值
                ,field = obj.field; //得到字段
            console.log("$$$$$$$$$");
            console.log("value:",value);
            console.log("data:",data);
            console.log("field:",field);
            console.log(data.Id);
            $.ajax({
                url:'/apply/updateRemark',
                data:{"remark":value,"Id":data.Id},
                success:function (data) {
                    console.log(data.info);
                    if (data.info == '修改成功'){
                        layer.msg("填写成功");
                    }else {
                        layer.msg("修改失败");
                    }
                }
            })
        });
    });

</script>
</body>
</html>




